diff --git a/django/views/debug.py b/django/views/debug.py
index 7a89f7bd15..fc9c9cca8f 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -396,10 +396,10 @@ class ExceptionReporter:
 
     def get_traceback_frames(self):
         def explicit_or_implicit_cause(exc_value):
-            explicit = getattr(exc_value, '__cause__', None)
-            suppress_context = getattr(exc_value, '__suppress_context__', None)
-            implicit = getattr(exc_value, '__context__', None)
-            return explicit or (None if suppress_context else implicit)
+            return (
+                exc_value.__cause__ or
+                (None if exc_value.__suppress_context__ else exc_value.__context__)
+            )
 
         # Get the exception and all its causes
         exceptions = []
